//
//  YBMessageReadTableViewCell.m
//  GongXinDangJian
//
//  Created by apple on 17/12/1.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "YBMessageReadTableViewCell.h"

@interface YBMessageReadTableViewCell ()
@property (nonatomic , strong) UILabel * cellTitleLabel;

@property (nonatomic , strong) UILabel * timeLabel;

@property (nonatomic , strong) UIImageView * attachmentImageView;
@end

@implementation YBMessageReadTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self ybInitMyCell];
        self.backgroundColor = [UIColor themeGrayColor];
    }
    return self;
}


-(void)ybInitMyCell{
    UIView * cellContentView = [[UIView alloc]initWithFrame:CGRectMake(0, ItemHeight * 10, [UIScreen zj_screenWith], ItemHeight * 130)];
    cellContentView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:cellContentView];
    [cellContentView addSubview:self.cellTitleLabel];
    [cellContentView addSubview:self.attachmentImageView];
    [cellContentView addSubview:self.timeLabel];
}


-(void)setModel:(YBAcceptMessageListModel *)model
{
    _model = model;
    self.cellTitleLabel.text = [ToolClass returnNoNullStringWithString:model.TITLE];
    self.timeLabel.text = [ToolClass returnNoNullStringWithString:model.MSG_START_TIME];
    if (model.MSG_RES_ID.length == 0) {
        self.attachmentImageView.hidden = YES;
    }
    else{
        self.attachmentImageView.hidden = NO;
    }
}


-(UILabel *)cellTitleLabel
{
    if (!_cellTitleLabel) {
        _cellTitleLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 20, ItemHeight * 10, [UIScreen zj_screenWith] - ItemWidth * 124, ItemHeight * 50) font:16 textColor:[UIColor textGrayColor] text:@""];
    }
    return _cellTitleLabel;
}


-(UIImageView *)attachmentImageView
{
    if (!_attachmentImageView) {
        _attachmentImageView = [[UIImageView alloc]initWithFrame:CGRectMake([UIScreen zj_screenWith] - ItemWidth * 57, (ItemHeight * 70 - ItemWidth * 27) / 2, ItemWidth * 27, ItemWidth * 27)];
        _attachmentImageView.image = [UIImage imageNamed:@"icon_appendix"];
    }
    return _attachmentImageView;
}


-(UILabel *)timeLabel
{
    if (!_timeLabel) {
        _timeLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 20, ItemHeight * 80, [UIScreen zj_screenWith] - ItemWidth * 124, ItemHeight * 30) font:13 textColor:[UIColor textGrayColor] text:@""];
    }
    return _timeLabel;
}


@end
